<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <title>Code coverage for Discourse-question-answer</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <script src='./assets/0.12.3/application.js' type='text/javascript'></script>
    <link href='./assets/0.12.3/application.css' media='screen, projection, print' rel='stylesheet' type='text/css' />
    <link rel="shortcut icon" type="image/png" href="./assets/0.12.3/favicon_green.png" />
    <link rel="icon" type="image/png" href="./assets/0.12.3/favicon.png" />
  </head>

  <body>
    <div id="loading">
      <img src="./assets/0.12.3/loading.gif" alt="loading"/>
    </div>
    <div id="wrapper" class="hide">
      <div class="timestamp">Generated <abbr class="timeago" title="2020-12-12T03:39:39+00:00">2020-12-12T03:39:39+00:00</abbr></div>
      <ul class="group_tabs"></ul>

      <div id="content">
        <div class="file_list_container" id="AllFiles">
  <h2>
    <span class="group_name">All Files</span>
    (<span class="covered_percent">
      <span class="green">
  97.02%
</span>

     </span>
     covered at
     <span class="covered_strength">
       <span class="green">
         16.09
       </span>
    </span> hits/line
    )
  </h2>

  <a name="AllFiles"></a>

  <div>
    <b>21</b> files in total.
  </div>

  <div class="t-line-summary">
    <b>369</b> relevant lines,
    <span class="green"><b>358</b> lines covered</span> and
    <span class="red"><b>11</b> lines missed. </span>
    (<span class="green">
  97.02%
</span>
)
  </div>

  

  <div class="file_list--responsive">
    <table class="file_list">
      <thead>
        <tr>
          <th>File</th>
          <th class="cell--number">% covered</th>
          <th class="cell--number">Lines</th>
          <th class="cell--number">Relevant Lines</th>
          <th class="cell--number">Lines covered</th>
          <th class="cell--number">Lines missed</th>
          <th class="cell--number">Avg. Hits / Line</th>
          
        </tr>
      </thead>
      <tbody>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#ac07f0c2b7a4d954ee573122aff5e89de0215864" class="src_link" title="app/controllers/question_answer/votes_controller.rb">app/controllers/question_answer/votes_controller.rb</a></td>
            <td class="yellow strong cell--number t-file__coverage">87.27 %</td>
            <td class="cell--number">127</td>
            <td class="cell--number">55</td>
            <td class="cell--number">48</td>
            <td class="cell--number">7</td>
            <td class="cell--number">3.22</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#b25c645540e85529282dda72060dd94942b7e795" class="src_link" title="app/serializers/question_answer/voter_serializer.rb">app/serializers/question_answer/voter_serializer.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">9</td>
            <td class="cell--number">3</td>
            <td class="cell--number">3</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.00</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#7a434eead3d8252a6bd8866d063bdbb09d5d2432" class="src_link" title="config/routes.rb">config/routes.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">11</td>
            <td class="cell--number">6</td>
            <td class="cell--number">6</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.00</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#881af4bf973f409e603eacc9c1b833c6eb7564d7" class="src_link" title="extensions/category_custom_field_extension.rb">extensions/category_custom_field_extension.rb</a></td>
            <td class="yellow strong cell--number t-file__coverage">87.50 %</td>
            <td class="cell--number">17</td>
            <td class="cell--number">8</td>
            <td class="cell--number">7</td>
            <td class="cell--number">1</td>
            <td class="cell--number">1.00</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#2d9437fbf8fc3cf7b655aa817bc4e9787427383a" class="src_link" title="extensions/category_extension.rb">extensions/category_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">19</td>
            <td class="cell--number">6</td>
            <td class="cell--number">6</td>
            <td class="cell--number">0</td>
            <td class="cell--number">122.17</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#49f1d01c5a21e257ea76e89d511c814328f64a8c" class="src_link" title="extensions/guardian_extension.rb">extensions/guardian_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">21</td>
            <td class="cell--number">8</td>
            <td class="cell--number">8</td>
            <td class="cell--number">0</td>
            <td class="cell--number">2.38</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#3571a38823b78a42f43c5a9a61bc2868164debdc" class="src_link" title="extensions/post_action_type_extension.rb">extensions/post_action_type_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">9</td>
            <td class="cell--number">4</td>
            <td class="cell--number">4</td>
            <td class="cell--number">0</td>
            <td class="cell--number">36.00</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#6f94f0af68c1f499d7e4e017c9b422a6a863d9ba" class="src_link" title="extensions/post_creator_extension.rb">extensions/post_creator_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">10</td>
            <td class="cell--number">5</td>
            <td class="cell--number">5</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.00</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#7170dcce4202d3d7c02b2e4f7ec10c154e0d7595" class="src_link" title="extensions/post_extension.rb">extensions/post_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">66</td>
            <td class="cell--number">31</td>
            <td class="cell--number">31</td>
            <td class="cell--number">0</td>
            <td class="cell--number">26.16</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#a201051d601346bb009d462f312be739068f73da" class="src_link" title="extensions/post_serializer_extension.rb">extensions/post_serializer_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">80</td>
            <td class="cell--number">39</td>
            <td class="cell--number">39</td>
            <td class="cell--number">0</td>
            <td class="cell--number">12.77</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#9aa2b2636e54d90ffbd3876780131120ab53486d" class="src_link" title="extensions/topic_extension.rb">extensions/topic_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">167</td>
            <td class="cell--number">76</td>
            <td class="cell--number">76</td>
            <td class="cell--number">0</td>
            <td class="cell--number">34.84</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#74eeea17bee59453f781aa3b28c75ad3fb32dda8" class="src_link" title="extensions/topic_list_item_serializer_extension.rb">extensions/topic_list_item_serializer_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">26</td>
            <td class="cell--number">12</td>
            <td class="cell--number">12</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.33</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#4babc00f2add331f368178816d9a5212fb02d3bb" class="src_link" title="extensions/topic_tag_extension.rb">extensions/topic_tag_extension.rb</a></td>
            <td class="red strong cell--number t-file__coverage">80.00 %</td>
            <td class="cell--number">21</td>
            <td class="cell--number">10</td>
            <td class="cell--number">8</td>
            <td class="cell--number">2</td>
            <td class="cell--number">1.40</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#09ba731d1b1a200fef492a9a3f8210f11fc5e9e2" class="src_link" title="extensions/topic_view_extension.rb">extensions/topic_view_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">9</td>
            <td class="cell--number">4</td>
            <td class="cell--number">4</td>
            <td class="cell--number">0</td>
            <td class="cell--number">4.50</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#5edf6fccc4f5525f120e151b7a53d9398adab16a" class="src_link" title="extensions/topic_view_serializer_extension.rb">extensions/topic_view_serializer_extension.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">88</td>
            <td class="cell--number">36</td>
            <td class="cell--number">36</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.61</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#f3190b029812cbcf9af8c4cb4ed671066dd919bd" class="src_link" title="jobs/qa_update_topics_post_order.rb">jobs/qa_update_topics_post_order.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">17</td>
            <td class="cell--number">8</td>
            <td class="cell--number">8</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.63</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#ac3fc60381c316d41b52e7a397495f5db023c847" class="src_link" title="jobs/update_category_post_order.rb">jobs/update_category_post_order.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">23</td>
            <td class="cell--number">11</td>
            <td class="cell--number">11</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.73</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#a1ea3b4460b8e7955c5a0a0012e83bb6f500d965" class="src_link" title="jobs/update_topic_post_order.rb">jobs/update_topic_post_order.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">19</td>
            <td class="cell--number">9</td>
            <td class="cell--number">9</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.67</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#bf5f7dacff3736d3492851ffcf3748c4afaed8aa" class="src_link" title="lib/question_answer/engine.rb">lib/question_answer/engine.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">6</td>
            <td class="cell--number">4</td>
            <td class="cell--number">4</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.00</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#376f40ac0445e7bbd3e65d17dbe9f7e095cd56bb" class="src_link" title="lib/question_answer/vote.rb">lib/question_answer/vote.rb</a></td>
            <td class="green strong cell--number t-file__coverage">96.88 %</td>
            <td class="cell--number">58</td>
            <td class="cell--number">32</td>
            <td class="cell--number">31</td>
            <td class="cell--number">1</td>
            <td class="cell--number">22.66</td>
            
          </tr>
        
          <tr class="t-file">
            <td class="strong t-file__name"><a href="#dcd1e2929160863b2832b707d9758a820447ed90" class="src_link" title="lib/question_answer/voter.rb">lib/question_answer/voter.rb</a></td>
            <td class="green strong cell--number t-file__coverage">100.00 %</td>
            <td class="cell--number">5</td>
            <td class="cell--number">2</td>
            <td class="cell--number">2</td>
            <td class="cell--number">0</td>
            <td class="cell--number">1.00</td>
            
          </tr>
        
      </tbody>
    </table>
  </div>
</div>


        
      </div>

      <div id="footer">
        Generated by <a href="https://github.com/simplecov-ruby/simplecov">simplecov</a> v0.20.0
        and simplecov-html v0.12.3<br/>
        using RSpec
      </div>

      <div class="source_files">
      
        <div class="source_table" id="ac07f0c2b7a4d954ee573122aff5e89de0215864">
  <div class="header">
    <h3>app/controllers/question_answer/votes_controller.rb</h3>
    <h4>
      <span class="yellow">
  87.27%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>55</b> relevant lines.
      <span class="green"><b>48</b> lines covered</span> and
      <span class="red"><b>7</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  class VotesController &lt; ::ApplicationController</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    before_action :ensure_logged_in</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">    before_action :find_vote_post</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="7">
            <span class="hits">1</span>
            

            

            <code class="ruby">    before_action :find_vote_user, only: [:create, :destroy]</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="8">
            <span class="hits">1</span>
            

            

            <code class="ruby">    before_action :ensure_qa_enabled, only: [:create, :destroy]</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="9">
            <span class="hits">1</span>
            

            

            <code class="ruby">    before_action :ensure_staff, only: [:set_as_answer]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="10">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="11">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def create</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="12">
            <span class="hits">5</span>
            

            

            <code class="ruby">      unless Topic.qa_can_vote(@post.topic, @user)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="13">
            <span class="hits">1</span>
            

            

            <code class="ruby">        raise Discourse::InvalidAccess.new(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby">          nil,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">          nil,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby">          custom_message: &#39;vote.error.user_over_limit&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby">        )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="18">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="19">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="20">
            <span class="hits">4</span>
            

            

            <code class="ruby">      unless @post.qa_can_vote(@user.id)</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="21">
            
            

            

            <code class="ruby">        raise Discourse::InvalidAccess.new(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="22">
            
            

            

            <code class="ruby">          nil,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="23">
            
            

            

            <code class="ruby">          nil,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="24">
            
            

            

            <code class="ruby">          custom_message: &#39;vote.error.one_vote_per_post&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="25">
            
            

            

            <code class="ruby">        )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="26">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="27">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="28">
            <span class="hits">4</span>
            

            

            <code class="ruby">      if QuestionAnswer::Vote.vote(@post, @user, vote_args)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="29">
            <span class="hits">4</span>
            

            

            <code class="ruby">        render json: success_json.merge(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="30">
            
            

            

            <code class="ruby">          qa_votes: Topic.qa_votes(@post.topic, @user),</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="31">
            
            

            

            <code class="ruby">          qa_can_vote: Topic.qa_can_vote(@post.topic, @user)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="32">
            
            

            

            <code class="ruby">        )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="33">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="34">
            
            

            

            <code class="ruby">        render json: failed_json, status: 422</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="35">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="36">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="37">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="38">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def destroy</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="39">
            <span class="hits">2</span>
            

            

            <code class="ruby">      if Topic.qa_votes(@post.topic, @user).length.zero?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="40">
            <span class="hits">1</span>
            

            

            <code class="ruby">        raise Discourse::InvalidAccess.new(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="41">
            
            

            

            <code class="ruby">          nil,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="42">
            
            

            

            <code class="ruby">          nil,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="43">
            
            

            

            <code class="ruby">          custom_message: &#39;vote.error.user_has_not_voted&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="44">
            
            

            

            <code class="ruby">        )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="45">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="46">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="47">
            <span class="hits">1</span>
            

            

            <code class="ruby">      if !QuestionAnswer::Vote.can_undo(@post, @user)</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="48">
            
            

            

            <code class="ruby">        window = SiteSetting.qa_undo_vote_action_window</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="49">
            
            

            

            <code class="ruby">        msg = I18n.t(&#39;vote.error.undo_vote_action_window&#39;, minutes: window)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="50">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="51">
            
            

            

            <code class="ruby">        render_json_error(msg, status: 403)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="52">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="53">
            
            

            

            <code class="ruby">        return</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="54">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="55">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="56">
            <span class="hits">1</span>
            

            

            <code class="ruby">      if QuestionAnswer::Vote.vote(@post, @user, vote_args)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="57">
            <span class="hits">1</span>
            

            

            <code class="ruby">        render json: success_json.merge(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="58">
            
            

            

            <code class="ruby">          qa_votes: Topic.qa_votes(@post.topic, @user),</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="59">
            
            

            

            <code class="ruby">          qa_can_vote: Topic.qa_can_vote(@post.topic, @user)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="60">
            
            

            

            <code class="ruby">        )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="61">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="62">
            
            

            

            <code class="ruby">        render json: failed_json, status: 422</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="63">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="64">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="65">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="66">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def set_as_answer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="67">
            <span class="hits">1</span>
            

            

            <code class="ruby">      @post.reply_to_post_number = nil</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="68">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="69">
            <span class="hits">1</span>
            

            

            <code class="ruby">      @post.save!</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="70">
            <span class="hits">1</span>
            

            

            <code class="ruby">      Topic.qa_update_vote_order(@post.topic)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="71">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="72">
            <span class="hits">1</span>
            

            

            <code class="ruby">      render json: success_json</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="73">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="74">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="75">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def voters</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="3" data-linenumber="76">
            <span class="hits">3</span>
            

            

            <code class="ruby">      voters = []</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="77">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="3" data-linenumber="78">
            <span class="hits">3</span>
            

            

            <code class="ruby">      if @post.qa_voted.any?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="79">
            <span class="hits">1</span>
            

            

            <code class="ruby">        @post.qa_voted.each do |user_id|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="80">
            <span class="hits">1</span>
            

            

            <code class="ruby">          if (user = User.find_by(id: user_id))</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="81">
            <span class="hits">1</span>
            

            

            <code class="ruby">            voters.push(QuestionAnswer::Voter.new(user))</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="82">
            
            

            

            <code class="ruby">          end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="83">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="84">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="85">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="3" data-linenumber="86">
            <span class="hits">3</span>
            

            

            <code class="ruby">      render_json_dump(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="87">
            
            

            

            <code class="ruby">        voters: serialize_data(voters, QuestionAnswer::VoterSerializer)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="88">
            
            

            

            <code class="ruby">      )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="89">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="90">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="91">
            <span class="hits">1</span>
            

            

            <code class="ruby">    private</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="92">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="93">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def vote_params</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="25" data-linenumber="94">
            <span class="hits">25</span>
            

            

            <code class="ruby">      params.require(:vote).permit(:post_id, :user_id, :direction)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="95">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="96">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="97">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def vote_args</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="98">
            
            

            

            <code class="ruby">      {</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="99">
            <span class="hits">5</span>
            

            

            <code class="ruby">        direction: vote_params[:direction],</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="100">
            
            

            

            <code class="ruby">        action: action_name</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="101">
            
            

            

            <code class="ruby">      }</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="102">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="103">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="104">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def find_vote_post</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="15" data-linenumber="105">
            <span class="hits">15</span>
            

            

            <code class="ruby">      if params[:vote].present?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="11" data-linenumber="106">
            <span class="hits">11</span>
            

            

            <code class="ruby">        post_id = vote_params[:post_id]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="107">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="108">
            <span class="hits">4</span>
            

            

            <code class="ruby">        params.require(:post_id)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="109">
            <span class="hits">4</span>
            

            

            <code class="ruby">        post_id = params[:post_id]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="110">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="111">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="15" data-linenumber="112">
            <span class="hits">15</span>
            

            

            <code class="ruby">      @post = Post.find_by(id: post_id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="113">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="15" data-linenumber="114">
            <span class="hits">15</span>
            

            

            <code class="ruby">      raise Discourse::NotFound unless @post</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="115">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="116">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="117">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def find_vote_user</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="9" data-linenumber="118">
            <span class="hits">9</span>
            

            

            <code class="ruby">      @user = User.find_by(id: vote_params[:user_id])</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="119">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="9" data-linenumber="120">
            <span class="hits">9</span>
            

            

            <code class="ruby">      raise Discourse::NotFound unless @user</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="121">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="122">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="123">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def ensure_qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="8" data-linenumber="124">
            <span class="hits">8</span>
            

            

            <code class="ruby">      raise Discourse::InvalidAccess.new unless Topic.qa_enabled(@post.topic)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="125">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="126">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="127">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="b25c645540e85529282dda72060dd94942b7e795">
  <div class="header">
    <h3>app/serializers/question_answer/voter_serializer.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>3</b> relevant lines.
      <span class="green"><b>3</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  class VoterSerializer &lt; ::PostActionUserSerializer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def post_url</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="6">
            
            

            

            <code class="ruby">      nil</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="7a434eead3d8252a6bd8866d063bdbb09d5d2432">
  <div class="header">
    <h3>config/routes.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>6</b> relevant lines.
      <span class="green"><b>6</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">QuestionAnswer::Engine.routes.draw do</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  resource :vote</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">  get &#39;voters&#39; =&gt; &#39;votes#voters&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">  post &#39;set_as_answer&#39; =&gt; &#39;votes#set_as_answer&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="9">
            <span class="hits">1</span>
            

            

            <code class="ruby">Discourse::Application.routes.append do</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="10">
            <span class="hits">1</span>
            

            

            <code class="ruby">  mount ::QuestionAnswer::Engine, at: &#39;qa&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="11">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="881af4bf973f409e603eacc9c1b833c6eb7564d7">
  <div class="header">
    <h3>extensions/category_custom_field_extension.rb</h3>
    <h4>
      <span class="yellow">
  87.5%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>8</b> relevant lines.
      <span class="green"><b>7</b> lines covered</span> and
      <span class="red"><b>1</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module CategoryCustomFieldExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def self.included(base)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">      base.after_commit :update_post_order, if: :qa_enabled_changed</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="9">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_enabled_changed</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="10">
            <span class="hits">2</span>
            

            

            <code class="ruby">      name == &#39;qa_enabled&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="11">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="13">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def update_post_order</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="14">
            
            

            

            <code class="ruby">      Jobs.enqueue(:update_category_post_order, category_id: category_id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="2d9437fbf8fc3cf7b655aa817bc4e9787427383a">
  <div class="header">
    <h3>extensions/category_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>6</b> relevant lines.
      <span class="green"><b>6</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module CategoryExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_cast(key)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="362" data-linenumber="6">
            <span class="hits">362</span>
            

            

            <code class="ruby">      ActiveModel::Type::Boolean.new.cast(custom_fields[key]) || false</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="9">
            <span class="hits">1</span>
            

            

            <code class="ruby">    %w[</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="10">
            
            

            

            <code class="ruby">      qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="11">
            
            

            

            <code class="ruby">      qa_one_to_many</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby">      qa_disable_like_on_answers</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="13">
            
            

            

            <code class="ruby">      qa_disable_like_on_questions</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby">      qa_disable_like_on_comments</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">    ].each do |key|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="367" data-linenumber="16">
            <span class="hits">367</span>
            

            

            <code class="ruby">      define_method(key.to_sym) { qa_cast(key) }</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="18">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="19">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="49f1d01c5a21e257ea76e89d511c814328f64a8c">
  <div class="header">
    <h3>extensions/guardian_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>8</b> relevant lines.
      <span class="green"><b>8</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module GuardianExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def can_create_post_on_topic?(topic)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="6">
            <span class="hits">4</span>
            

            

            <code class="ruby">      post = self.try(:post_opts) || {}</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="7">
            <span class="hits">4</span>
            

            

            <code class="ruby">      category = topic.category</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="9">
            <span class="hits">4</span>
            

            

            <code class="ruby">      if category.present? &amp;&amp;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="10">
            
            

            

            <code class="ruby">         category.qa_enabled &amp;&amp;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="11">
            
            

            

            <code class="ruby">         category.qa_one_to_many &amp;&amp;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby">         post.present? &amp;&amp;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="13">
            
            

            

            <code class="ruby">         !post[:reply_to_post_number]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="15">
            <span class="hits">2</span>
            

            

            <code class="ruby">        return @user.id == topic.user_id</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="18">
            <span class="hits">2</span>
            

            

            <code class="ruby">      super(topic)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="19">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="20">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="21">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="3571a38823b78a42f43c5a9a61bc2868164debdc">
  <div class="header">
    <h3>extensions/post_action_type_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>4</b> relevant lines.
      <span class="green"><b>4</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module PostActionTypeExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def public_types</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="141" data-linenumber="6">
            <span class="hits">141</span>
            

            

            <code class="ruby">      @public_types ||= super.except(:vote)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="6f94f0af68c1f499d7e4e017c9b422a6a863d9ba">
  <div class="header">
    <h3>extensions/post_creator_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>5</b> relevant lines.
      <span class="green"><b>5</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module PostCreatorExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def valid?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">      guardian.post_opts = @opts</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="7">
            <span class="hits">1</span>
            

            

            <code class="ruby">      super</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="10">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="7170dcce4202d3d7c02b2e4f7ec10c154e0d7595">
  <div class="header">
    <h3>extensions/post_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>31</b> relevant lines.
      <span class="green"><b>31</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module PostExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def self.included(base)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">      base.ignored_columns = %w[vote_count]</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="7">
            <span class="hits">1</span>
            

            

            <code class="ruby">      base.after_create :qa_update_vote_order, if: :qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="10">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_vote_count</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="86" data-linenumber="11">
            <span class="hits">86</span>
            

            

            <code class="ruby">      if vote_count = custom_fields[&#39;vote_count&#39;]</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="31" data-linenumber="12">
            <span class="hits">31</span>
            

            

            <code class="ruby">        [*vote_count].first.to_i</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="13">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="55" data-linenumber="14">
            <span class="hits">55</span>
            

            

            <code class="ruby">        0</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="18">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_voted</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="98" data-linenumber="19">
            <span class="hits">98</span>
            

            

            <code class="ruby">      if custom_fields[&#39;voted&#39;].present?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="30" data-linenumber="20">
            <span class="hits">30</span>
            

            

            <code class="ruby">        [*custom_fields[&#39;voted&#39;]].map(&amp;:to_i)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="21">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="68" data-linenumber="22">
            <span class="hits">68</span>
            

            

            <code class="ruby">        []</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="23">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="24">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="25">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="26">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_vote_history</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="71" data-linenumber="27">
            <span class="hits">71</span>
            

            

            <code class="ruby">      if custom_fields[&#39;vote_history&#39;].present?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="45" data-linenumber="28">
            <span class="hits">45</span>
            

            

            <code class="ruby">        [*custom_fields[&#39;vote_history&#39;]]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="29">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="26" data-linenumber="30">
            <span class="hits">26</span>
            

            

            <code class="ruby">        []</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="31">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="32">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="33">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="34">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="155" data-linenumber="35">
            <span class="hits">155</span>
            

            

            <code class="ruby">      ::Topic.qa_enabled(topic)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="36">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="37">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="38">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_update_vote_order</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="39">
            <span class="hits">5</span>
            

            

            <code class="ruby">      ::Topic.qa_update_vote_order(topic_id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="40">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="41">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="42">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_last_voted(user_id)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="6" data-linenumber="43">
            <span class="hits">6</span>
            

            

            <code class="ruby">      user_votes = qa_vote_history.select do |v|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="6" data-linenumber="44">
            <span class="hits">6</span>
            

            

            <code class="ruby">        v[&#39;user_id&#39;].to_i == user_id &amp;&amp; v[&#39;action&#39;] == &#39;create&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="45">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="46">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="6" data-linenumber="47">
            <span class="hits">6</span>
            

            

            <code class="ruby">      return unless user_votes.any?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="48">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="49">
            <span class="hits">5</span>
            

            

            <code class="ruby">      user_votes</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="6" data-linenumber="50">
            <span class="hits">6</span>
            

            

            <code class="ruby">        .max_by { |v| v[&#39;created_at&#39;].to_datetime.to_i }[&#39;created_at&#39;]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="51">
            
            

            

            <code class="ruby">        .to_datetime</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="52">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="53">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="54">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_can_vote(user_id)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="7" data-linenumber="55">
            <span class="hits">7</span>
            

            

            <code class="ruby">      SiteSetting.qa_tl_allow_multiple_votes_per_post ||</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="56">
            
            

            

            <code class="ruby">        !qa_voted.include?(user_id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="57">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="58">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="59">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def comments</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="92" data-linenumber="60">
            <span class="hits">92</span>
            

            

            <code class="ruby">      topic</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="61">
            
            

            

            <code class="ruby">        .posts</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="62">
            
            

            

            <code class="ruby">        .where(reply_to_post_number: self.post_number)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="63">
            
            

            

            <code class="ruby">        .order(&#39;post_number ASC&#39;)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="64">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="65">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="66">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="a201051d601346bb009d462f312be739068f73da">
  <div class="header">
    <h3>extensions/post_serializer_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>39</b> relevant lines.
      <span class="green"><b>39</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module PostSerializerExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def actions_summary</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="146" data-linenumber="6">
            <span class="hits">146</span>
            

            

            <code class="ruby">      summaries = super.reject { |s| s[:id] == PostActionType.types[:vote] }</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="20" data-linenumber="8">
            <span class="hits">20</span>
            

            

            <code class="ruby">      return summaries unless object.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="10">
            <span class="hits">14</span>
            

            

            <code class="ruby">      user = scope.current_user</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="11">
            
            

            

            <code class="ruby">      summary = {</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="12">
            <span class="hits">14</span>
            

            

            <code class="ruby">        id: PostActionType.types[:vote],</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="13">
            
            

            

            <code class="ruby">        count: object.qa_vote_count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby">      }</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="16">
            <span class="hits">14</span>
            

            

            <code class="ruby">      if user</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="12" data-linenumber="17">
            <span class="hits">12</span>
            

            

            <code class="ruby">        voted = object.qa_voted.include?(user.id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="18">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="12" data-linenumber="19">
            <span class="hits">12</span>
            

            

            <code class="ruby">        if voted</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="20">
            <span class="hits">2</span>
            

            

            <code class="ruby">          summary[:acted] = true</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="21">
            <span class="hits">2</span>
            

            

            <code class="ruby">          summary[:can_undo] = QuestionAnswer::Vote.can_undo(object, user)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="22">
            
            

            

            <code class="ruby">        else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="10" data-linenumber="23">
            <span class="hits">10</span>
            

            

            <code class="ruby">          summary[:can_act] = true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="24">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="25">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="26">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="27">
            <span class="hits">14</span>
            

            

            <code class="ruby">      summary.delete(:count) if summary[:count].zero?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="28">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="29">
            <span class="hits">14</span>
            

            

            <code class="ruby">      if summary[:can_act] || summary[:count]</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="13" data-linenumber="30">
            <span class="hits">13</span>
            

            

            <code class="ruby">        summaries + [summary]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="31">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="32">
            <span class="hits">1</span>
            

            

            <code class="ruby">        summaries</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="33">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="34">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="35">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="36">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_vote_count</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="20" data-linenumber="37">
            <span class="hits">20</span>
            

            

            <code class="ruby">      object.qa_vote_count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="38">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="39">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="40">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_voted</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="20" data-linenumber="41">
            <span class="hits">20</span>
            

            

            <code class="ruby">      object.qa_voted</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="42">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="43">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="44">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="20" data-linenumber="45">
            <span class="hits">20</span>
            

            

            <code class="ruby">      object.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="46">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="47">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="48">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answerer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="49">
            <span class="hits">14</span>
            

            

            <code class="ruby">      object.topic.last_answerer</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="50">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="51">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="52">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_last_answerer?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="20" data-linenumber="53">
            <span class="hits">20</span>
            

            

            <code class="ruby">      object.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="54">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="55">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="56">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answered_at</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="57">
            <span class="hits">14</span>
            

            

            <code class="ruby">      object.topic.last_answered_at</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="58">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="59">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="60">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_last_answered_at?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="20" data-linenumber="61">
            <span class="hits">20</span>
            

            

            <code class="ruby">      object.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="62">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="63">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="64">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def answer_count</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="65">
            <span class="hits">14</span>
            

            

            <code class="ruby">      object.topic.answer_count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="66">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="67">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="68">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_answer_count?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="20" data-linenumber="69">
            <span class="hits">20</span>
            

            

            <code class="ruby">      object.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="70">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="71">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="72">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answer_post_number</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="73">
            <span class="hits">14</span>
            

            

            <code class="ruby">      object.topic.last_answer_post_number</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="74">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="75">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="76">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_last_answer_post_number?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="20" data-linenumber="77">
            <span class="hits">20</span>
            

            

            <code class="ruby">      object.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="78">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="79">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="80">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="9aa2b2636e54d90ffbd3876780131120ab53486d">
  <div class="header">
    <h3>extensions/topic_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>76</b> relevant lines.
      <span class="green"><b>76</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module TopicExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def self.included(base)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">      base.extend(ClassMethods)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="9">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def reload(options = nil)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="10">
            <span class="hits">4</span>
            

            

            <code class="ruby">      @answers = nil</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="11">
            <span class="hits">4</span>
            

            

            <code class="ruby">      @comments = nil</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="12">
            <span class="hits">4</span>
            

            

            <code class="ruby">      @last_answerer = nil</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="13">
            <span class="hits">4</span>
            

            

            <code class="ruby">      super(options)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="16">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def answers</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="124" data-linenumber="17">
            <span class="hits">124</span>
            

            

            <code class="ruby">      @answers ||= begin</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="17" data-linenumber="18">
            <span class="hits">17</span>
            

            

            <code class="ruby">        posts</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="19">
            
            

            

            <code class="ruby">          .where(reply_to_post_number: nil)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="20">
            
            

            

            <code class="ruby">          .order(&#39;created_at ASC&#39;)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="21">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="22">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="23">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="24">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def first_answer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="25">
            <span class="hits">2</span>
            

            

            <code class="ruby">      posts</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="26">
            
            

            

            <code class="ruby">        .where(reply_to_post_number: nil)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="27">
            
            

            

            <code class="ruby">        .where.not(post_number: 1)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="28">
            
            

            

            <code class="ruby">        .order(&#39;sort_order&#39;)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="29">
            
            

            

            <code class="ruby">        .first</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="30">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="31">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="32">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def comments</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="9" data-linenumber="33">
            <span class="hits">9</span>
            

            

            <code class="ruby">      @comments ||= begin</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="34">
            <span class="hits">5</span>
            

            

            <code class="ruby">        posts</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="35">
            
            

            

            <code class="ruby">          .where.not(reply_to_post_number: nil)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="36">
            
            

            

            <code class="ruby">          .order(&#39;created_at ASC&#39;)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="37">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="38">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="39">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="40">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def answer_count</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="19" data-linenumber="41">
            <span class="hits">19</span>
            

            

            <code class="ruby">      answers.count - 1 ## minus first post</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="42">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="43">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="44">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def comment_count</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="45">
            <span class="hits">2</span>
            

            

            <code class="ruby">      comments.count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="46">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="47">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="48">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answered_at</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="18" data-linenumber="49">
            <span class="hits">18</span>
            

            

            <code class="ruby">      return unless answers.any?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="50">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="18" data-linenumber="51">
            <span class="hits">18</span>
            

            

            <code class="ruby">      answers.last[:created_at]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="52">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="53">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="54">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_commented_on</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="3" data-linenumber="55">
            <span class="hits">3</span>
            

            

            <code class="ruby">      return unless comments.any?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="56">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="57">
            <span class="hits">1</span>
            

            

            <code class="ruby">      comments.last[:created_at]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="58">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="59">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="60">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answer_post_number</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="18" data-linenumber="61">
            <span class="hits">18</span>
            

            

            <code class="ruby">      return unless answers.any?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="62">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="18" data-linenumber="63">
            <span class="hits">18</span>
            

            

            <code class="ruby">      answers.last[:post_number]</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="64">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="65">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="66">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answerer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="18" data-linenumber="67">
            <span class="hits">18</span>
            

            

            <code class="ruby">      return unless answers.any?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="68">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="18" data-linenumber="69">
            <span class="hits">18</span>
            

            

            <code class="ruby">      @last_answerer ||= User.find(answers.last[:user_id])</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="70">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="71">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="72">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="73">
            <span class="hits">5</span>
            

            

            <code class="ruby">      Topic.qa_enabled(self)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="74">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="75">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="76">
            
            

            

            <code class="ruby">    # class methods</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="77">
            <span class="hits">1</span>
            

            

            <code class="ruby">    module ClassMethods</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="78">
            <span class="hits">1</span>
            

            

            <code class="ruby">      def qa_can_vote(topic, user)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="22" data-linenumber="79">
            <span class="hits">22</span>
            

            

            <code class="ruby">        return false if user.blank? || !SiteSetting.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="80">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="19" data-linenumber="81">
            <span class="hits">19</span>
            

            

            <code class="ruby">        topic_vote_count = qa_votes(topic, user).length</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="82">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="19" data-linenumber="83">
            <span class="hits">19</span>
            

            

            <code class="ruby">        if topic_vote_count.positive? &amp;&amp; !SiteSetting.qa_trust_level_vote_limits</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="6" data-linenumber="84">
            <span class="hits">6</span>
            

            

            <code class="ruby">          return false</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="85">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="86">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="13" data-linenumber="87">
            <span class="hits">13</span>
            

            

            <code class="ruby">        trust_level = user.trust_level</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="88">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="13" data-linenumber="89">
            <span class="hits">13</span>
            

            

            <code class="ruby">        return false if trust_level.zero?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="90">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="12" data-linenumber="91">
            <span class="hits">12</span>
            

            

            <code class="ruby">        topic_vote_limit = SiteSetting.send(&quot;qa_tl#{trust_level}_vote_limit&quot;)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="12" data-linenumber="92">
            <span class="hits">12</span>
            

            

            <code class="ruby">        topic_vote_limit.to_i &gt; topic_vote_count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="93">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="94">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="95">
            
            

            

            <code class="ruby">      # rename to something like qa_user_votes?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="96">
            <span class="hits">1</span>
            

            

            <code class="ruby">      def qa_votes(topic, user)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="32" data-linenumber="97">
            <span class="hits">32</span>
            

            

            <code class="ruby">        return nil if !user || !SiteSetting.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="98">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="29" data-linenumber="99">
            <span class="hits">29</span>
            

            

            <code class="ruby">        PostCustomField.where(post_id: topic.posts.map(&amp;:id),</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="100">
            
            

            

            <code class="ruby">                              name: &#39;voted&#39;,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="101">
            
            

            

            <code class="ruby">                              value: user.id).pluck(:post_id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="102">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="103">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="104">
            <span class="hits">1</span>
            

            

            <code class="ruby">      def qa_enabled(topic)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="196" data-linenumber="105">
            <span class="hits">196</span>
            

            

            <code class="ruby">        return false unless SiteSetting.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="106">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="181" data-linenumber="107">
            <span class="hits">181</span>
            

            

            <code class="ruby">        return false if !topic || topic&amp;.is_category_topic?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="108">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="179" data-linenumber="109">
            <span class="hits">179</span>
            

            

            <code class="ruby">        tags = topic.tags.map(&amp;:name)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="110">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="179" data-linenumber="111">
            <span class="hits">179</span>
            

            

            <code class="ruby">        if !(tags &amp; SiteSetting.qa_blacklist_tags.split(&#39;|&#39;)).empty?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="112">
            <span class="hits">1</span>
            

            

            <code class="ruby">          return false</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="113">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="114">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="178" data-linenumber="115">
            <span class="hits">178</span>
            

            

            <code class="ruby">        has_qa_tag = !(tags &amp; SiteSetting.qa_tags.split(&#39;|&#39;)).empty?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="178" data-linenumber="116">
            <span class="hits">178</span>
            

            

            <code class="ruby">        is_qa_category = topic.category.present? &amp;&amp; topic.category.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="178" data-linenumber="117">
            <span class="hits">178</span>
            

            

            <code class="ruby">        is_qa_subtype = topic.subtype == &#39;question&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="118">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="178" data-linenumber="119">
            <span class="hits">178</span>
            

            

            <code class="ruby">        has_qa_tag || is_qa_category || is_qa_subtype</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="120">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="121">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="122">
            <span class="hits">1</span>
            

            

            <code class="ruby">      def qa_update_vote_order(topic_id)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="54" data-linenumber="123">
            <span class="hits">54</span>
            

            

            <code class="ruby">        return unless SiteSetting.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="124">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="54" data-linenumber="125">
            <span class="hits">54</span>
            

            

            <code class="ruby">        posts = Post.where(topic_id: topic_id)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="54" data-linenumber="126">
            <span class="hits">54</span>
            

            

            <code class="ruby">        op = posts.find_by(post_number: 1)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="127">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="54" data-linenumber="128">
            <span class="hits">54</span>
            

            

            <code class="ruby">        op.update(sort_order: 1)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="129">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="54" data-linenumber="130">
            <span class="hits">54</span>
            

            

            <code class="ruby">        count = 2</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="131">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="132">
            
            

            

            <code class="ruby">        # OP comments</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="54" data-linenumber="133">
            <span class="hits">54</span>
            

            

            <code class="ruby">        op.comments.each do |c|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="134">
            <span class="hits">5</span>
            

            

            <code class="ruby">          c.update(sort_order: count)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="135">
            <span class="hits">5</span>
            

            

            <code class="ruby">          count += 1</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="136">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="137">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="138">
            
            

            

            <code class="ruby">        answers = begin</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="54" data-linenumber="139">
            <span class="hits">54</span>
            

            

            <code class="ruby">          posts</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="140">
            
            

            

            <code class="ruby">            .where(reply_to_post_number: nil)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="141">
            
            

            

            <code class="ruby">            .where.not(post_number: 1)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="142">
            
            

            

            <code class="ruby">            .order(&quot;(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="143">
            
            

            

            <code class="ruby">              SELECT COALESCE ((</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="144">
            
            

            

            <code class="ruby">                SELECT value::integer FROM post_custom_fields</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="145">
            
            

            

            <code class="ruby">                WHERE post_id = posts.id AND name = &#39;vote_count&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="146">
            
            

            

            <code class="ruby">              ), 0)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="147">
            
            

            

            <code class="ruby">            ) DESC, post_number ASC&quot;)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="148">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="149">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="54" data-linenumber="150">
            <span class="hits">54</span>
            

            

            <code class="ruby">        answers.each do |a|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="38" data-linenumber="151">
            <span class="hits">38</span>
            

            

            <code class="ruby">          a.update(sort_order: count)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="152">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="38" data-linenumber="153">
            <span class="hits">38</span>
            

            

            <code class="ruby">          comments = a.comments</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="154">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="38" data-linenumber="155">
            <span class="hits">38</span>
            

            

            <code class="ruby">          if comments.any?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="156">
            <span class="hits">14</span>
            

            

            <code class="ruby">            comments.each do |c|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="42" data-linenumber="157">
            <span class="hits">42</span>
            

            

            <code class="ruby">              count += 1</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="42" data-linenumber="158">
            <span class="hits">42</span>
            

            

            <code class="ruby">              c.update(sort_order: count)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="159">
            
            

            

            <code class="ruby">            end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="160">
            
            

            

            <code class="ruby">          end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="161">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="38" data-linenumber="162">
            <span class="hits">38</span>
            

            

            <code class="ruby">          count += 1</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="163">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="164">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="165">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="166">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="167">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="74eeea17bee59453f781aa3b28c75ad3fb32dda8">
  <div class="header">
    <h3>extensions/topic_list_item_serializer_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>12</b> relevant lines.
      <span class="green"><b>12</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module TopicListItemSerializerExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def self.included(base)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">      base.attributes :qa_enabled,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">                      :answer_count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="10">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="11">
            <span class="hits">1</span>
            

            

            <code class="ruby">      true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="13">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="14">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_qa_enabled?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="15">
            <span class="hits">4</span>
            

            

            <code class="ruby">      Topic.qa_enabled object</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="18">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def answer_count</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="19">
            <span class="hits">1</span>
            

            

            <code class="ruby">      object.answer_count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="20">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="21">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="22">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_answer_count?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="23">
            <span class="hits">2</span>
            

            

            <code class="ruby">      include_qa_enabled?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="24">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="25">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="26">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="4babc00f2add331f368178816d9a5212fb02d3bb">
  <div class="header">
    <h3>extensions/topic_tag_extension.rb</h3>
    <h4>
      <span class="red">
  80.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>10</b> relevant lines.
      <span class="green"><b>8</b> lines covered</span> and
      <span class="red"><b>2</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module TopicTagExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def self.included(base)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">      base.after_destroy :update_post_order, if: :qa_tag?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby">    </code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="9">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_tag?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="10">
            <span class="hits">4</span>
            

            

            <code class="ruby">      if tag = Tag.find_by(id: tag_id)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="11">
            <span class="hits">4</span>
            

            

            <code class="ruby">        !([tag.name] &amp; SiteSetting.qa_tags.split(&#39;|&#39;)).empty? </code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="13">
            
            

            

            <code class="ruby">        false</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="17">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def update_post_order</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="18">
            
            

            

            <code class="ruby">      Jobs.enqueue(:update_topic_post_order, topic_id: topic_id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="19">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="20">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="21">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="09ba731d1b1a200fef492a9a3f8210f11fc5e9e2">
  <div class="header">
    <h3>extensions/topic_view_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>4</b> relevant lines.
      <span class="green"><b>4</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module TopicViewExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="15" data-linenumber="6">
            <span class="hits">15</span>
            

            

            <code class="ruby">      Topic.qa_enabled(@topic)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="5edf6fccc4f5525f120e151b7a53d9398adab16a">
  <div class="header">
    <h3>extensions/topic_view_serializer_extension.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>36</b> relevant lines.
      <span class="green"><b>36</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  module TopicViewSerializerExtension</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def self.included(base)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">      base.attributes(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby">        :qa_enabled,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="8">
            
            

            

            <code class="ruby">        :qa_votes,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby">        :qa_can_vote,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="10">
            
            

            

            <code class="ruby">        :last_answered_at,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="11">
            
            

            

            <code class="ruby">        :last_commented_on,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby">        :answer_count,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="13">
            
            

            

            <code class="ruby">        :comment_count,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby">        :last_answer_post_number,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">        :last_answerer,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby">        :first_answer_id</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby">      )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="18">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="19">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="20">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def first_answer_id</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="21">
            <span class="hits">2</span>
            

            

            <code class="ruby">      object.topic.first_answer&amp;.id</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="22">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="23">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="24">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="14" data-linenumber="25">
            <span class="hits">14</span>
            

            

            <code class="ruby">      object.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="26">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="27">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="28">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_votes</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="29">
            <span class="hits">2</span>
            

            

            <code class="ruby">      Topic.qa_votes(object.topic, scope.current_user)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="30">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="31">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="32">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def qa_can_vote</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="33">
            <span class="hits">2</span>
            

            

            <code class="ruby">      Topic.qa_can_vote(object.topic, scope.current_user)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="34">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="35">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="36">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answered_at</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="37">
            <span class="hits">1</span>
            

            

            <code class="ruby">      object.topic.last_answered_at</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="38">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="39">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="40">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_last_answered_at?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="41">
            <span class="hits">2</span>
            

            

            <code class="ruby">      qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="42">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="43">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="44">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_commented_on</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="45">
            <span class="hits">1</span>
            

            

            <code class="ruby">      object.topic.last_commented_on</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="46">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="47">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="48">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_last_commented_on?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="49">
            <span class="hits">2</span>
            

            

            <code class="ruby">      qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="50">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="51">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="52">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def answer_count</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="53">
            <span class="hits">1</span>
            

            

            <code class="ruby">      object.topic.answer_count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="54">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="55">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="56">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_answer_count?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="57">
            <span class="hits">2</span>
            

            

            <code class="ruby">      qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="58">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="59">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="60">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def comment_count</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="61">
            <span class="hits">1</span>
            

            

            <code class="ruby">      object.topic.comment_count</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="62">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="63">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="64">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_comment_count?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="65">
            <span class="hits">2</span>
            

            

            <code class="ruby">      qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="66">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="67">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="68">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answer_post_number</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="69">
            <span class="hits">1</span>
            

            

            <code class="ruby">      object.topic.last_answer_post_number</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="70">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="71">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="72">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_last_answer_post_number?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="73">
            <span class="hits">2</span>
            

            

            <code class="ruby">      qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="74">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="75">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="76">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def last_answerer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="77">
            <span class="hits">1</span>
            

            

            <code class="ruby">      BasicUserSerializer.new(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="78">
            
            

            

            <code class="ruby">        object.topic.last_answerer,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="79">
            
            

            

            <code class="ruby">        scope: scope,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="80">
            
            

            

            <code class="ruby">        root: false</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="81">
            
            

            

            <code class="ruby">      )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="82">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="83">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="84">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def include_last_answerer?</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="85">
            <span class="hits">2</span>
            

            

            <code class="ruby">      qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="86">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="87">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="88">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="f3190b029812cbcf9af8c4cb4ed671066dd919bd">
  <div class="header">
    <h3>jobs/qa_update_topics_post_order.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>8</b> relevant lines.
      <span class="green"><b>8</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module Jobs</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  class QAUpdateTopicsPostOrder &lt; ::Jobs::Onceoff</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def execute_onceoff(_args)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">      Topic.find_each do |topic|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="7">
            <span class="hits">2</span>
            

            

            <code class="ruby">        if topic.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="8">
            <span class="hits">1</span>
            

            

            <code class="ruby">          Topic.qa_update_vote_order(topic.id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby">        else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="10">
            <span class="hits">1</span>
            

            

            <code class="ruby">          topic.posts.each do |post|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="5" data-linenumber="11">
            <span class="hits">5</span>
            

            

            <code class="ruby">            post.update_columns(sort_order: post.post_number)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby">          end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="13">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="ac3fc60381c316d41b52e7a397495f5db023c847">
  <div class="header">
    <h3>jobs/update_category_post_order.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>11</b> relevant lines.
      <span class="green"><b>11</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module Jobs</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  class UpdateCategoryPostOrder &lt; ::Jobs::Base</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def execute(args)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="6">
            <span class="hits">2</span>
            

            

            <code class="ruby">      category = Category.find_by(id: args[:category_id])</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="8">
            <span class="hits">2</span>
            

            

            <code class="ruby">      return if category.blank?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="10">
            <span class="hits">2</span>
            

            

            <code class="ruby">      qa_enabled = category.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="11">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="12">
            <span class="hits">2</span>
            

            

            <code class="ruby">      Topic.where(category_id: category.id).each do |topic|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="13">
            <span class="hits">2</span>
            

            

            <code class="ruby">        if qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="14">
            <span class="hits">1</span>
            

            

            <code class="ruby">          Topic.qa_update_vote_order(topic.id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">        else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="16">
            <span class="hits">1</span>
            

            

            <code class="ruby">          topic.posts.each do |post|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="17">
            <span class="hits">4</span>
            

            

            <code class="ruby">            post.update_columns(sort_order: post.post_number)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="18">
            
            

            

            <code class="ruby">          end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="19">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="20">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="21">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="22">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="23">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="a1ea3b4460b8e7955c5a0a0012e83bb6f500d965">
  <div class="header">
    <h3>jobs/update_topic_post_order.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>9</b> relevant lines.
      <span class="green"><b>9</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module Jobs</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  class UpdateTopicPostOrder &lt; ::Jobs::Base</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def execute(args)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="6">
            <span class="hits">2</span>
            

            

            <code class="ruby">      topic = Topic.find_by(id: args[:topic_id])</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="7">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="8">
            <span class="hits">2</span>
            

            

            <code class="ruby">      return if topic.blank?</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="2" data-linenumber="10">
            <span class="hits">2</span>
            

            

            <code class="ruby">      if topic.qa_enabled</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="11">
            <span class="hits">1</span>
            

            

            <code class="ruby">        Topic.qa_update_vote_order(topic.id)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="13">
            <span class="hits">1</span>
            

            

            <code class="ruby">        topic.posts.each do |post|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="4" data-linenumber="14">
            <span class="hits">4</span>
            

            

            <code class="ruby">          post.update_columns(sort_order: post.post_number)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="15">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="16">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="17">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="18">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="19">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="bf5f7dacff3736d3492851ffcf3748c4afaed8aa">
  <div class="header">
    <h3>lib/question_answer/engine.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>4</b> relevant lines.
      <span class="green"><b>4</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="1">
            <span class="hits">1</span>
            

            

            <code class="ruby">module ::QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="2">
            <span class="hits">1</span>
            

            

            <code class="ruby">  class Engine &lt; Rails::Engine</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">    engine_name &#39;question_answer&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">    isolate_namespace QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="5">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="6">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="376f40ac0445e7bbd3e65d17dbe9f7e095cd56bb">
  <div class="header">
    <h3>lib/question_answer/vote.rb</h3>
    <h4>
      <span class="green">
  96.88%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>32</b> relevant lines.
      <span class="green"><b>31</b> lines covered</span> and
      <span class="red"><b>1</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  class Vote</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="5">
            <span class="hits">1</span>
            

            

            <code class="ruby">    CREATE = &#39;create&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="6">
            <span class="hits">1</span>
            

            

            <code class="ruby">    DESTROY = &#39;destroy&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="7">
            <span class="hits">1</span>
            

            

            <code class="ruby">    UP = &#39;up&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="8">
            <span class="hits">1</span>
            

            

            <code class="ruby">    DOWN = &#39;down&#39;</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="9">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="10">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def self.vote(post, user, args)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="11">
            <span class="hits">44</span>
            

            

            <code class="ruby">      modifier = 0</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="12">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="13">
            <span class="hits">44</span>
            

            

            <code class="ruby">      voted = post.qa_voted</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="14">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="15">
            <span class="hits">44</span>
            

            

            <code class="ruby">      if args[:direction] == UP</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="16">
            <span class="hits">44</span>
            

            

            <code class="ruby">        if args[:action] == CREATE</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="32" data-linenumber="17">
            <span class="hits">32</span>
            

            

            <code class="ruby">          voted.push(user.id)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="32" data-linenumber="18">
            <span class="hits">32</span>
            

            

            <code class="ruby">          modifier = 1</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="12" data-linenumber="19">
            <span class="hits">12</span>
            

            

            <code class="ruby">        elsif args[:action] == DESTROY</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="12" data-linenumber="20">
            <span class="hits">12</span>
            

            

            <code class="ruby">          modifier = 0</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="12" data-linenumber="21">
            <span class="hits">12</span>
            

            

            <code class="ruby">          voted.delete_if do |user_id|</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="17" data-linenumber="22">
            <span class="hits">17</span>
            

            

            <code class="ruby">            if user_id == user.id</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="11" data-linenumber="23">
            <span class="hits">11</span>
            

            

            <code class="ruby">              modifier -= 1</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="11" data-linenumber="24">
            <span class="hits">11</span>
            

            

            <code class="ruby">              true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="25">
            
            

            

            <code class="ruby">            end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="26">
            
            

            

            <code class="ruby">          end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="27">
            
            

            

            <code class="ruby">        end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="28">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="29">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="30">
            <span class="hits">44</span>
            

            

            <code class="ruby">      post.custom_fields[&#39;vote_count&#39;] = post.qa_vote_count + modifier</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="31">
            <span class="hits">44</span>
            

            

            <code class="ruby">      post.custom_fields[&#39;voted&#39;] = voted</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="32">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="33">
            <span class="hits">44</span>
            

            

            <code class="ruby">      votes = post.qa_vote_history</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="34">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="35">
            <span class="hits">44</span>
            

            

            <code class="ruby">      votes.push(</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="36">
            
            

            

            <code class="ruby">        direction: args[:direction],</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="37">
            
            

            

            <code class="ruby">        action: args[:action],</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="38">
            
            

            

            <code class="ruby">        user_id: user.id,</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="39">
            
            

            

            <code class="ruby">        created_at: Time.now</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="40">
            
            

            

            <code class="ruby">      )</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="41">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="42">
            <span class="hits">44</span>
            

            

            <code class="ruby">      post.custom_fields[&#39;vote_history&#39;] = votes</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="43">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="44">
            <span class="hits">44</span>
            

            

            <code class="ruby">      if post.save_custom_fields(true)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="45">
            <span class="hits">44</span>
            

            

            <code class="ruby">        Topic.qa_update_vote_order(post.topic)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="46">
            <span class="hits">44</span>
            

            

            <code class="ruby">        post.publish_change_to_clients! :acted</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="44" data-linenumber="47">
            <span class="hits">44</span>
            

            

            <code class="ruby">        true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="48">
            
            

            

            <code class="ruby">      else</code>
          </li>
        </div>
      
        <div>
          <li class="missed" data-hits="0" data-linenumber="49">
            
            

            

            <code class="ruby">        false</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="50">
            
            

            

            <code class="ruby">      end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="51">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="52">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="53">
            <span class="hits">1</span>
            

            

            <code class="ruby">    def self.can_undo(post, user)</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="3" data-linenumber="54">
            <span class="hits">3</span>
            

            

            <code class="ruby">      window = SiteSetting.qa_undo_vote_action_window.to_i</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="3" data-linenumber="55">
            <span class="hits">3</span>
            

            

            <code class="ruby">      window.zero? || post.qa_last_voted(user.id).to_i &gt; window.minutes.ago.to_i</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="56">
            
            

            

            <code class="ruby">    end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="57">
            
            

            

            <code class="ruby">  end</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="58">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
        <div class="source_table" id="dcd1e2929160863b2832b707d9758a820447ed90">
  <div class="header">
    <h3>lib/question_answer/voter.rb</h3>
    <h4>
      <span class="green">
  100.0%
</span>

      lines covered
    </h4>

    

    <div class="t-line-summary">
      <b>2</b> relevant lines.
      <span class="green"><b>2</b> lines covered</span> and
      <span class="red"><b>0</b> lines missed.</span>
    </div>

    

  </div>

  <pre>
    <ol>
      
        <div>
          <li class="never" data-hits="" data-linenumber="1">
            
            

            

            <code class="ruby"># frozen_string_literal: true</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="2">
            
            

            

            <code class="ruby"></code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="3">
            <span class="hits">1</span>
            

            

            <code class="ruby">module QuestionAnswer</code>
          </li>
        </div>
      
        <div>
          <li class="covered" data-hits="1" data-linenumber="4">
            <span class="hits">1</span>
            

            

            <code class="ruby">  Voter = Struct.new(:user)</code>
          </li>
        </div>
      
        <div>
          <li class="never" data-hits="" data-linenumber="5">
            
            

            

            <code class="ruby">end</code>
          </li>
        </div>
      
    </ol>
  </pre>
</div>

      
      </div>
    </div>
  </body>
</html>
